import { Message, Notification } from '@arco-design/web-vue';
import type { NotificationConfig } from '@arco-design/web-vue';

export class Feedback {
    private static instance: Feedback
    private constructor() { }
    public static getInstance(): Feedback {
        if (!Feedback.instance) {
            Feedback.instance = new Feedback()
        }
        return Feedback.instance
    }

    
    notifySuccess( config: NotificationConfig  ){

        Notification.success({
            id: config.id ?? '',
            title: config.title ?? '成功消息',
            content: config.content ?? '',
            duration: config.duration ?? 3000,
            position: config.position ?? 'topRight',
        })
    }

    notifyError( config: NotificationConfig  ){
        Notification.error({
            id: config.id ??  '',
            title: config.title ?? '失败消息',
            content: config.content ?? '',
            duration: config.duration ?? 3000,
            position: config.position ?? 'topRight',
        })
    }
}

const feedback = Feedback.getInstance()

export default feedback
